<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>信息发送</title>
</head>

<body>
    <label for="xx">电话号:</label>
    <input type="text" id="xx">
    <button id="btn">发送</button>
    <script>

        btn.onclick = function () {
            var num = 30;
            var timer = setInterval(function () {
                num--
                btn.disabled=true
                btn.innerHTML = '还剩' + num + '秒'

                if (num == 0) {
                    clearInterval(timer)
                    btn.disabled=false
                    btn.innerHTML = '发送'
                    num = 3;
                }
            }, 1000)

        }
    </script>
</body>

</html>